// @Author EthanScriptOn
// @Desc
package extend_param_collector

import (
	"time"
)

type KafkaProducerParams struct {
	Params []*KafkaProducerParam
}

type Header struct {
	Key   string
	Value []byte
}

type KafkaProducerParam struct {
	Topic         string
	Key           []byte
	Value         []byte
	Headers       []Header
	Metadata      string
	Offset        int64
	Partition     int32
	Timestamp     time.Time
	TimestampType int
}

func (k *KafkaProducerParams) IsValid() bool {
	if len(k.Params) <= 0 {
		return false
	}
	for _, param := range k.Params {
		if !param.IsValid() {
			return false
		}
	}
	return true
}

func (k *KafkaProducerParam) IsValid() bool {
	return k.Topic != "" && k.Value != nil
}
